package day07.Private;
/*
    封装和private的应用
        A:把成员变量用private修饰
        B:提高对应的getXxx()和setXxx()方法
 */
class Student{
    private String name;
    private int age;

    public void setName(String name){
        this.name = name;
    }

    public void setAge(int age){
        this.age = age;
    }

    public String getName(){
        return this.name;
    }

    public int getAge(){
        return this.age;
    }

}

public class PrivateDemo {
    public static void main(String[] args) {
        Student s = new Student();
        System.out.println(s.getAge());
        System.out.println(s.getName());

        System.out.println("------------");

        s.setAge(27);
        s.setName("Alex");
        System.out.println(s.getAge());
        System.out.println(s.getName());
    }
}
